<template>
	<view :data-theme="theme()" :class="'order-datail pb100' + theme()" v-if="!loadding">
		<!--{{$t('order.status_details')}}-->
		<view class="order-state d-s-c">
			<view class="icon-box">
				<span v-if="detail.stateTextValue == 30" class="icon iconfont icon-icon"></span>
				<span v-if="detail.stateTextValue == 50" class="icon iconfont icon-daishouhuo"></span>
				<span v-if="detail.stateTextValue == 20" class="icon iconfont icon-xuanze"></span>
				<span v-if="detail.stateTextValue == 10" class="icon iconfont icon-gantanhao"></span>
			</view>
			<view class="state-cont flex-1">
				<view class="state-txt d-b-c">
					<text class="desc f34">{{ detail.stateText }}</text>
				</view>
				<view class="status-price pt10" v-if="detail.payStatus == 10">{{ $t('order.amount_due0') }}HK$ {{
					detail.payPrice }}</view>
				<view class="countdown-datetime" v-if="detail.payEndTimeText">
					<text>{{ $t('order.auto_close_countdown', { place1: detail.payEndTimeText }) }}</text>
				</view>
			</view>
			<view class="dot-bg"></view>
		</view>

		<!--{{$t('order.logistics_address')}}-->
		<view class="order-express p30 d-s-c" v-if="detail.deliveryType == 10">
			<view class="icon-box">
				<image style="width: 42rpx; height: 42rpx" src="../../static/icon/address_icon.png" mode=""></image>
			</view>
			<view class="cont-text flex-1 o-h ml20 f30">
				<view class="express-text f32">
					{{ detail.address.name }}
					<text class="f26 gray9">{{ detail.address.phone }}</text>
				</view>
				<view class="gray3 f26 pt10">
					{{ detail.address.region.province }}{{ detail.address.region.city
					}}{{ detail.address.region.region }}{{ detail.address.detail }}
				</view>
			</view>
			<view class="icon iconfont icon-jiantou"></view>
		</view>
		<!-- 上门自提：自提门店 -->
		<view class="order-express p30 d-s-s" v-if="detail.deliveryType == 20">
			<view class="flow-delivery__title m-top20"><span class="icon iconfont icon-dizhi1">{{
				$t('order.pickup_store') }}</span></view>
			<view class="cont-text flex-1 o-h ml20 f30">
				<view class="express-text">
					{{ detail.extractStore.storeName }} {{ detail.extractStore.phone }}
					<view class="f24 gray9 pt10">{{ detail.extractStore.province }} {{ detail.extractStore.city }}
						{{ detail.extractStore.region }}
						{{ detail.extractStore.address }}
					</view>
				</view>
			</view>
		</view>

		<!-- 物流信息 -->
		<!-- <view class="group bg-white" v-if="detail.deliveryType == 10 && detail.deliveryStatus == 20" @click="gotoExpress(detail.orderId)">
			<view class="d-b-c">
				<view class="f28">
					<view class="p-20-0">
						<text class="gray9">{{$t('order.logistics_company')}}</text>
						<text>{{ detail.express.expressName }}</text>
					</view>
					<view class="p-20-0">
						<text class="gray9">{{$t('order.logistics_tracking_number')}}</text>
						<text>{{ detail.expressNo }}</text>
					</view>
				</view>
				<view><text class="icon iconfont icon-jiantou"></text></view>
			</view>
		</view> -->

		<!--{{$t('order.shopping_list')}}-->
		<view class="shops group bg-white">
			<view class="group-hd border-b-e" @tap="
				gotoPage('/pages/shop/shop?shopSupplierId=' + detail.shopSupplierId)
				">
				<view class="left">
					<i class="icon iconfont icon-dianpu1"></i>
					<text class="min-name">{{ detail.supplierName }}</text>
					<text class="icon iconfont icon-jiantou"></text>
				</view>
			</view>

			<view class="list">
				<view class="one-product p-20-0" v-for="(item, index) in detail.product" :key="index">
					<view class="d-s-c">
						<view class="cover">
							<image :src="item.productImage" mode="aspectFit"></image>
						</view>
						<view class="flex-1">
							<view class="p-0-30 text-ellipsis-2 gray3 f30">{{
								item.productName
							}}</view>
							<view class="pt10 p-0-30 gray6 f24">{{ item.productAttr }}</view>
							<view class="pt10 p-0-30 d-b-c">
								<template v-if="item.isUserGrade != 1">
									<view class="price f22">
										HK$
										<text class="f40">{{ item.productPrice }}</text>
									</view>
								</template>
								<template v-else>
									<view class="text-l-t f22">
										HK$
										<text class="f40">{{ item.productPrice }}</text>
									</view>
								</template>
								<view class="f24 gray9">x{{ item.totalNum }}</view>
							</view>
							<view class="mt10 tr f28" v-if="item.isUserGrade == 1">
								<text class="red">{{ $t('order.member_discount_price') }}</text>
								<text class="red">{{ item.gradeProductPrice }}</text>
							</view>
						</view>
					</view>
					<view v-if="item.tableId > 0 && item.tableRecordId > 0" class="supplement-box">
						<view class="p20" v-for="(table_item, table_index) in item.tableData" :key="table_index">
							<view class="d-s-s" v-if="table_item.type == 'image'">
								<text class="gray6 mr15">{{ table_item.name }}:</text>
								<image style="width: 80rpx; height: 80rpx" @click="yulan(table_item.value, 0)"
									:src="table_item.value" mode="aspectFill"></image>
							</view>
							<template v-else>
								<text class="gray6 mr15">{{ table_item.name }}:</text>
								<text>{{ table_item.value }}</text>
							</template>
						</view>
					</view>
					<view class="pt10 d-e-c">
						<!-- 申请售后 -->
						<view class="m-top20 dis-flex flex-x-end">
							<text v-if="item.refund && source == 'user'" class="red">{{
								item.refundState
							}}</text>
							<view v-if="detail.isAllowRefund && item.refund === false"
								@click="onApplyRefund(item.orderProductId)"><button type="default">{{
									$t('order.request_after_sales') }}</button></view>
							<!--{{$t('order.resubmit_allowed_after_rejection')}}    refundStatus {{$t('order.after_sales_status')}}({{$t('order.status_in_progress',{place1:0})}} {{$t('order.status_rejected',{place1:10})}} {{$t('order.status_completed',{place1:20})}} {{$t('order.status_cancelled',{place1:30})}})-->
							<view v-if="
								detail.isAllowRefund &&
								item.refund &&
								item.refundStatus === 10
							" @click="onApplyRefund(item.orderProductId)"><button type="default">{{ $t('order.resubmit_after_sales')
									}}</button></view>
						</view>
					</view>
					<view class="pt10 d-e-c" v-if="item.tableId > 0 && item.tableRecordId == 0">
						<!-- 补充表单 -->
						<view class="m-top20 dis-flex flex-x-end">
							<view @click="onSaveTable(item.tableId, item.orderProductId)"><button class="theme-btn">{{
								$t('order.additional_info') }}</button></view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="group bg-white" v-if="detail.payStatus == 20&&detail.deliveryType==20">
			<view class="f32 fb p-0-20">{{$t('order.voucher_code')}}</view>
			<view class="d-c-c">
				<image
					style="width: 400rpx;height: 400rpx;margin: 40rpx auto;"
					:src="`${baseUrl}/api/front/user/order/extractQrcode?orderId=${orderId}&appId=${getAppId()}`"
					mode="scaleToFill"
				/>
			</view>
		</view>
		<!--{{$t('order.order_info')}}-->
		<view class="group bg-white f26">
			<view class="p-20-0">
				<text class="">{{ $t('order.order_id') }}</text>
				<text selectable>{{ detail.orderNo }}</text>
				<text class="blue ml20" @click="copyTexts(detail.orderNo)">{{ $t('order.copy') }}</text>
			</view>
			<view class="p-20-0" v-if="detail.createTime">
				<text class="">{{ $t('order.order_time') }}</text>
				<text>{{ detail.createTime }}</text>
			</view>
			<view class="p-20-0" v-if="detail.payTime">
				<text class="">{{ $t('order.payment_time') }}</text>
				<text>{{ detail.payTime }}</text>
			</view>
			<view class="p-20-0" v-if="detail.deliveryTime">
				<text class="">{{ $t('order.shipment_time') }}</text>
				<text>{{ detail.deliveryTime }}</text>
			</view>
			<view class="p-20-0" v-if="detail.receiptTime">
				<text class="">{{ $t('order.completion_time') }}</text>
				<text>{{ detail.receiptTime }}</text>
			</view>
			<view class="p-20-0">
				<text class="">{{ $t('order.payment_method0') }}</text>
				<text>{{ detail.payTypeText }}</text>
			</view>

			<view class="p-20-0">
				<text class="">{{ $t('order.delivery_method') }}</text>
				<text>{{ detail.deliveryTypeText }}</text>
			</view>
			<view class="p-20-0" v-if="
				detail.deliveryType == 30 &&
				detail.orderStatus == 30 &&
				detail.virtualContent != ''
			">
				<text class="">{{ $t('order.shipping_info') }}</text>
				<text class="copys" @click="copyTexts(detail.virtualContent)">
					{{ detail.virtualContent }}
				</text>
			</view>
			<view class="p-20-0">
				<text class="">{{ $t('order.note') }}</text>
				<text>{{ detail.buyerRemark }}</text>
			</view>
			<view class="p-20-0">
				<text class="">{{$t('order.shop_remark')}}</text>
				<text>{{ detail.shopRemark }}</text>
			</view>
			<view class="p-20-0" v-if="detail.orderStatus == 20 && detail.cancelRemark != ''">
				<text class="">{{ $t('order.seller_note') }}</text>
				<text>{{ detail.cancelRemark }}</text>
			</view>
			<view v-if="service_open && detail.serviceUserId != 0" class="p-20-0 kefu" @click="tochat">
				<text class="icon iconfont icon-kefu2"></text>
				<text class="">{{ $t('order.contact_seller') }}</text>
			</view>
		</view>
		<view class="wrapper" v-if="customForm && customForm.length">
			<view class="item acea-row row-between" v-for="(item, index) in customForm" :key="index">
				<view class="upload" v-if="item.label == 'img'">
					<view class="diy-from-title">{{ item.title }}：</view>
					<view class="pictrue" v-for="(img, index) in item.value" :key="index">
						<image :src="img.filePath"></image>
					</view>
				</view>
				<view v-if="item.label !== 'img'" class="diy-from-title">{{ item.title }}：</view>
				<view v-if="item.label !== 'img'" class="conter">{{ item.value }}</view>
			</view>
			<view class="copy-text" @click="copyText()"> {{ $t('order.copy') }} </view>
		</view>
		
		<view class="group bg-white f26">
			<view class="p-20-0 d-b-c" v-if="detail.orderSource == 80">
				<text class="">{{ $t('order.deposit') }}</text>
				<text>HK${{ detail.advance.payPrice }}</text>
			</view>
			<view class="p-20-0 d-b-c" v-if="detail.payPrice && detail.orderSource == 80">
				<text class="">{{ $t('order.final_payment') }}</text>
				<text>HK${{ detail.payPrice }}</text>
			</view>
			<view class="p-20-0 d-b-c" v-if="detail.advance && detail.advance.reduceMoney > 0">
				<text class="">{{ $t('order.final_discount') }}</text>
				<text>-HK$ {{ detail.advance.reduceMoney }}</text>
			</view>
			<view class="p-20-0 d-b-c" v-if="detail.orderSource == 20">
				<text class="">{{ $t('order.points_deducted') }}</text>
				<text>-{{ detail.pointsNum }}{{ pointsName }}</text>
			</view>
			<!-- <view class="p-20-0 d-b-c">
				<text class="">{{$t('order.order_total')}}</text>
				<text>HK$ {{ detail.totalPrice }}</text>
			</view> -->
			<view class="p-20-0 d-b-c" v-if="detail.updatePrice != '0.00'">
				<text class="gray9">{{ $t('order.order_diff') }}</text>
				<text>HK$ {{ detail.updatePrice }}</text>
			</view>
			<view class="p-20-0 d-b-c">
				<text class="">{{ $t('order.shipping_fee') }}</text>
				<text>HK$ {{ detail.expressPrice }}</text>
			</view>
			<view class="p-20-0 d-b-c" v-if="detail.productReduceMoney > 0">
				<text class="">{{ $t('order.item_discount') }}</text>
				<text>-HK$ {{ detail.productReduceMoney }}</text>
			</view>
			<view class="p-20-0 d-b-c" v-if="detail.fullreduceMoney > 0">
				<text class="">{{ $t('order.threshold_discount') }}</text>
				<text>-HK$ {{ detail.fullreduceMoney }}</text>
			</view>
			<view class="p-20-0 d-b-c" v-if="detail.pointsMoney > 0">
				<text class="">{{ $t('order.points_offset') }}</text>
				<text>-HK$ {{ detail.pointsMoney }}</text>
			</view>
			<view class="p-20-0 d-b-c" v-if="detail.couponMoney > 0">
				<text class="">{{ $t('order.merchant_coupon') }}</text>
				<text class="theme-price">- HK$ {{ detail.couponMoney }}</text>
			</view>
			<view class="p-20-0 d-b-c" v-if="detail.couponMoneySys > 0">
				<text class="">{{ $t('order.platform_coupon0') }}</text>
				<text class="theme-price">- HK$ {{ detail.couponMoneySys }}</text>
			</view>
			<view class="p-20-0 d-e-c fb f34">
				{{ $t('order.amount_paid') }}
				<text class="red" v-if="detail.orderSource == 80">
					<template v-if="
						detail.advance &&
						detail.advance.payStatus == 20 &&
						detail.payStatus == 10
					">
						HK${{ detail.advance && detail.advance.payPrice }}
					</template>
					<template v-else-if="detail.payStatus == 20">
						HK${{
							parseFloat(detail.advance.payPrice) + parseFloat(detail.payPrice)
						}}
					</template>
					<template v-else-if="detail.payStatus == 10"> HK$0 </template>
				</text>
				<text class="red" v-else>HK$ {{ detail.payPrice }}</text>
			</view>
		</view>
		
		<view class="group bg-white" v-if="
			detail.payStatus == 20 &&
			detail.deliveryType == 10 &&
			detail.orderStatus == 10 &&
			detail.deliveryStatus == 10 &&
			source == 'supplier'
		">
			<!-- <view> -->
			<view class="f32 fb p-0-20">{{ $t('order.ship_now') }}</view>
			<!-- 下拉框 -->
			<view class="table-item">
				<view class="d-s-c make-top">
					<view class="fb color-28 f26 mr20">{{ $t('order.logistics_company0') }}</view>
				</view>
				<view class="">
					<picker class="" @change="changeSelect($event)" :range="expressList" range-key="expressName">
						<view class="selectpicker">
							<view class="make-item input-box flex-1">{{
								expressName || $t('order.please_select')
							}}</view>
							<view class="icon iconfont icon-jiantou"></view>
						</view>
					</picker>
				</view>
			</view>
			<view class="table-item">
				<view class="d-s-c make-top">
					<view class="fb color-28 f26 mr20">{{ $t('order.tracking_number') }}</view>
				</view>
				<view class="pr">
					<input class="make-item selectpicker input-box" v-model="expressNo" type="text"
						:placeholder="$t('order.please_enter')" />
				</view>
			</view>
			<view></view>
			<view><button type="default" class="btn-blue" @click="sendPro">
					{{ $t('order.confirm_shipment') }}
				</button></view>
		</view>

		<template v-if="detail.orderSource != 70">
			<template v-if="
				detail.orderSource != 20 &&
				detail.orderSource != 30 &&
				source == 'user'
			">
				<view class="foot-btns">
					<!-- 取消订单 -->
					<!-- 拼团订单 -->
					<template v-if="detail.orderSource == 80">
						<!-- 未支付取消订单 -->
						<template v-if="detail.orderStatus == 10 && detail.advance.payStatus == 10">
							<button class="theme-borderbtn" @click="cancelAdvance(detail.advance.orderAdvanceId)">
								{{ $t('order.apply_cancel') }}
							</button>
						</template>
						<!-- 支付定金取消订单 -->
						<template v-else-if="
							detail.advance.payStatus == 20 &&
							detail.advance.orderStatus == 10 &&
							detail.advance.moneyReturn == 1 &&
							detail.payStatus != 20
						">
							<button class="theme-borderbtn" @click="cancelAdvance(detail.advance.orderAdvanceId)">
								{{ $t('order.cancel_deposit') }}
							</button>
						</template>
						<!-- 支付完成取消订单，即定金和尾款都已支付 -->
						<!-- <template v-else-if="detail.advance.payStatus == 20 && detail.payStatus == 20 && detail.orderStatus != 21">
							<button class="theme-borderbtn" @click="cancelOrder(detail.orderId)">
								{{$t('order.cancel_order')}} 
							</button>
						</template> -->
					</template>
					<!-- 普通订单 -->
					<template v-else>
						<button class="theme-borderbtn" v-if="detail.payStatus == 10 && detail.orderStatus != 20"
							@click="cancelOrder(detail)">
							{{ $t('order.cancel_order') }}
						</button>
					</template>
					<block v-if="detail.orderStatus != 21">
						<block v-if="detail.orderStatus == 20"> {{ $t('order.order_cancelled') }} </block>
						<!-- 张保仔不要取消订单 20250812 -->
						<block v-else-if="detail.payStatus == 20 && detail.deliveryStatus == 10 && !notApplyCancel">
							<button @click="cancelOrder(detail)" class="theme-borderbtn">
								{{ $t('order.apply_cancel') }}
							</button>
						</block>
					</block>
					<text v-else class="count f28 gray9">{{ $t('order.canceling') }}</text>
					<block v-if="detail.payStatus == 10 && detail.orderStatus != 20">
						<!-- 订单付款 -->
						<!-- 拼团订单 -->
						<template v-if="detail.orderSource == 80">
							<!-- 付定金 -->
							<template v-if="
								detail.advance.payStatus == 10 &&
								!nowOverTime(detail.advance.payEndTime)
							">
								<button @click="
									gotoPage(
										'/pages/order/cashier?orderType=50&orderId=' +
										detail.advance.orderId
									)
									" class="ml10 theme-btn">
									{{ $t('order.pay_deposit') }}
								</button>
							</template>
							<!-- 付尾款 -->
							<template v-if="detail.advance.payStatus == 20">
								<template v-if="
									nowOverTime(detail.advance.endTime) &&
									detail.orderStatus != 20
								">
									<button @click="
										gotoPage(
											`/pages/order/cashier?orderId=${detail.advance.orderId}&orderType=80`
										)
										" class="ml10 theme-btn">
										{{ $t('order.pay_final_payment') }}
									</button>
								</template>
							</template>
						</template>
						<!-- 普通订单 -->
						<button @click="onPayOrder(detail.orderId)" v-else-if="detail.payStatus == 10"
							class="ml10 theme-btn">
							{{ $t('order.pay_now0') }}
						</button>
					</block>
					<!-- 确认收货 -->
					<block v-if="detail.deliveryStatus == 20 && detail.receiptStatus == 10">
						<button v-if="
							detail.payType == 20 && detail.paySource == 'wx' && isSendWx
						" class="theme-btn" @click="wxOrder(detail)">
							{{ $t('order.mini_program_confirm_receipt') }}
						</button>
						<button v-else class="theme-btn" @click="orderReceipt(detail.orderId)">
							{{ $t('order.confirm_receipt') }}
						</button>
					</block>
					<!-- 查看物流 -->
					<button class="theme-btn ml10" v-if="
						(detail.deliveryType == 40 || detail.deliveryType == 10) &&
						detail.deliveryStatus != 10
					" @click="gotoPage(`/pages/order/express/express?orderId=${orderId}&deliveryType=40`)">
						{{ $t('order.view_logistics') }}
					</button>
				</view>
			</template>
		</template>
		<!-- 操作栏 -->
		<!--{{$t('order.customer_service')}}-->
		<Mpservice v-if="isMpservice" :isMpservice="isMpservice" :shopSupplierId="shopSupplierId"
			@close="closeMpservice">
		</Mpservice>
	</view>
</template>

<script>
import Popup from "@/components/uni-popup.vue";
import {
	pay
} from "@/common/pay.js";
import Mpservice from "@/components/mpservice/Mpservice.vue";
export default {
	data() {
		return {
			customForm: "",
			/*是否加载完成*/
			loadding: true,
			indicatorDots: true,
			autoplay: true,
			interval: 2000,
			duration: 500,
			/*是否显示支付类别弹窗*/
			isPayPopup: false,
			/*订单id*/
			orderId: 0,
			/*订单详情*/
			detail: {
				orderStatus: [],
				address: {
					region: [],
				},
				product: [],
				payType: 0,
				deliveryType: 0,
				payStatus: 0,
				stateText: "",
			},
			pointsName: "",
			extractStore: {},
			isMpservice: false,
			shopSupplierId: 0,
			source: "user",
			expressList: [],
			expressId: "",
			expressName: "",
			expressNo: "",
			mchId: "",
			isSendWx: null,
		};
	},
	components: {
		Popup,
		Mpservice,
	},
	onLoad(e) {
		this.orderId = e.orderId;
		this.userId = uni.getStorageSync("userId");
		if (e.source) {
			this.source = e.source;
		}
	},
	mounted() {
		uni.showLoading({
			title: this.$t('order.loading'),
		});
	},
	onShow() {
		/*获取订单详情*/
		this.getData();
		uni.setNavigationBarTitle({
			title: this.$t('order.order_info')
		})
	},
	methods: {
		copyTexts(text) {
			uni.setClipboardData({
				data: text,
			});
		},
		copyText(text) {
			let str = "";
			this.customForm.map((e) => {
				if (e.label !== "img") {
					str += e.title + e.value;
				}
			});
			uni.setClipboardData({
				data: str,
			});
		},
		cancelAdvance(e) {
			let self = this;
			let order_id = e;
			uni.showModal({
				title: this.$t('order.prompt'),
				content: this.$t('order.confirm_cancel') + "?",
				success: function (o) {
					if (o.confirm) {
						uni.showLoading({
							title: self.$t('order.processing'),
						});
						self._get(
							"plus/advance/order/cancelFront", {
							orderAdvanceId: order_id,
						},
							function (res) {
								uni.hideLoading();
								uni.showToast({
									title: self.$t('order.operation_success'),
									duration: 2000,
									icon: "success",
								});
								self.listData = [];
								self.getData();
							}
						);
					}
				},
			});
		},
		nowOverTime(t) {
			let now = new Date().getTime();
			let time = new Date(t).getTime();
			return now >= time;
		},
		/*获取数据*/
		getData() {
			let self = this;
			let orderId = self.orderId;
			self._get(
				"user/order/detail", {
				orderId: orderId,
			},
				function (res) {
					self.expressList = res.data.expressList;
					self.detail = res.data.detail;
					self.isSendWx = self.detail.isSendWx;
					self.extractStore = res.data.extractStore;
					self.service_open = res.data.serviceOpen;
					self.service_type = res.data.serviceType;
					self.customForm = self.detail.customForm;
					self.shopSupplierId = res.data.detail.shopSupplierId;
					self.pointsName = self.$lang(res.data, 'pointsName');
					self.mchId = res.data.detail.mchId;
					self.loadding = false;
					uni.hideLoading();
				}
			);
		},
		/*关闭客服*/
		closeMpservice() {
			this.isMpservice = false;
		},
		/*取消订单*/
		cancelOrder(e) {
			let self = this;
			let order_id = e.orderId;
			let content = self.$t('order.confirm_cancel_order') + "?";
			if (e.isMore == 1) {
				content = this.$t('order.cancel_order_prompt');
			}
			wx.showModal({
				title: this.$t('order.prompt'),
				content: content,
				success: function (o) {
					if (o.confirm) {
						uni.showLoading({
							title: self.$t('order.processing'),
						});
						self._post(
							"user/order/cancel", {
							orderId: order_id,
						},
							function (res) {
								uni.hideLoading();
								uni.showToast({
									title: self.$t('order.operation_success'),
									duration: 2000,
									icon: "success",
								});
								self.getData();
							}
						);
					}
				},
			});
		},

		/*确认收货*/
		orderReceipt(orderId) {
			let self = this;
			wx.showModal({
				title: this.$t('order.prompt'),
				content: this.$t('order.confirm_take') + "?",
				success: function (o) {
					if (o.confirm) {
						uni.showLoading({
							title: self.$t('order.processing'),
						});
						self._post(
							"user/order/receipt", {
							orderId: orderId,
						},
							function (res) {
								uni.hideLoading();
								uni.showToast({
									title: res.msg,
									duration: 2000,
									icon: "success",
								});
								self.getData();
							}
						);
					}
				},
			});
		},
		wxOrder(item) {
			let self = this;
			if (wx.openBusinessView) {
				wx.openBusinessView({
					businessType: "weappOrderConfirm",
					extraData: {
						merchant_id: self.mchId,
						merchant_trade_no: item.tradeNo,
						transaction_id: item.transactionId,
					},
					success() {
						self._post(
							"user/order/receipt", {
							orderId: item.orderId,
						},
							function (res) {
								uni.showToast({
									title: res.msg,
									duration: 2000,
									icon: "success",
								});
								self.listData = [];
								self.getData();
							}
						);
					},
					fail() {
						//dosomething
					},
					complete() {
						//dosomething
					},
				});
			} else {
				//引导用户升级微信版本
			}
		},
		/*查看物流*/
		gotoExpress(orderId) {
			this.gotoPage(
				`/pages/order/express/express?orderId=${orderId}&deliveryType=10`
			);
		},
		/*申请售后*/
		onApplyRefund(e) {
			this.gotoPage("/pages/order/refund/apply/apply?orderProductId=" + e);
		},
		onSaveTable(tableId, orderProductId) {
			this.gotoPage(
				"/pages/plus/table/table?tableId=" +
				tableId +
				"&orderProductId=" +
				orderProductId
			);
		},
		/*去支付*/
		// payTypeFunc(payType) {
		// 	let self = this;
		// 	let order_id = self.order_id;
		// 	self.isPayPopup = false;
		// 	uni.showLoading({
		// 		title: '加载中'
		// 	});
		// 	self._post(
		// 		'user.order/pay',
		// 		{
		// 			payType: payType,
		// 			order_id: order_id,
		// 			pay_source: self.getPlatform()
		// 		},
		// 		function(res) {
		// 			uni.hideLoading();
		// 			pay(res, self);
		// 		}
		// 	);
		// },
		tochat() {
			if (this.service_type == 10) {
				this.isMpservice = true;
			}
			if (this.service_type == 20) {
				this.gotoPage(
					"/pages/plus/chat/chat?userId=" +
					this.detail.serviceUserId +
					"&shopSupplierId=" +
					this.detail.shopSupplierId +
					"&nickName=" +
					this.detail.nickName +
					"&orderId=" +
					this.orderId
				);
			}
		},
		/*支付方式选择*/
		onPayOrder(orderId) {
			let self = this;
			self.gotoPage("/pages/order/cashier?orderId=" + orderId);
		},
		changeSelect(e) {
			this.expressName = this.expressList[e.detail.value].expressName;
			this.expressId = this.expressList[e.detail.value].expressId;
		},
		sendPro() {
			let self = this;
			wx.showModal({
				title: this.$t('order.prompt'),
				content: this.$t('order.confirm_take') + "?",
				success: function (o) {
					if (o.confirm) {
						uni.showLoading({
							title: self.$t('order.processing'),
						});
						self._postBody(
							"supplier/order/delivery", {
							orderId: self.detail.orderId,
							expressId: self.expressId,
							expressNo: self.expressNo,
						},
							function (res) {
								uni.hideLoading();
								self.showSuccess(res.msg);
								self.getData();
							}
						);
					}
				},
			});
		},
	},
};
</script>

<style scoped lang="scss">
page {}

.btn-blue {
	background: #28a5ff;
	color: #ffffff;
	width: 120px;
}

.order-express {
	background: #ffffff;
	margin: 0 20rpx;
	border-radius: 12rpx;
	margin-top: 20rpx;
}

.order-express .icon-box .iconfont {
	font-size: 50rpx;
}

.order-datail {
	padding-bottom: 90rpx;
	background-color: #f2f2f2;
}

.order-datail .fight-users {
	margin: 0 auto;
}

.order-datail .fight-users .user-box {
	width: 80rpx;
	height: 80rpx;
	margin: 10rpx;
	border-radius: 50%;
	border: 1px dashed #cccccc;
}

.order-datail .fight-users {
	padding: 30rpx;
}

.order-datail .fight-users .user-box image {
	width: 80rpx;
	height: 80rpx;
	border-radius: 50%;
}

.order-datail .fight-users .user-box .leader {
	position: absolute;
	top: -20rpx;
	left: 50%;
	margin-left: -30rpx;
	width: 60rpx;
	height: 30rpx;
	line-height: 30rpx;
	text-align: center;
	color: #ffffff;
	border-radius: 30rpx;
	border: 1px solid #ffffff;
	background: red;
}

.order-datail .fight-users .user-box.user-who {
	font-size: 50rpx;
	color: #999999;
}

.state-cont .countdown-datetime {
	margin-top: 16rpx;
}

.state-cont .countdown-datetime text {
	padding: 4rpx 8rpx;
	border-radius: 4rpx;
	background: rgba(0, 0, 0, 0.4);
}

.icon-dianpu1 {
	margin-right: 15rpx;
}

.kefu {
	border-top: 1rpx solid #cacaca;
	display: flex;
	justify-content: center;
	align-items: center;
}

.kefu .icon-kefu2 {
	color: #1296db;
	margin-right: 8rpx;
}

.group {
	margin: 0 20rpx;
	margin-top: 20rpx;
	border-radius: 12rpx;
}

.foot-btns button {
	height: 60rpx;
	line-height: 60rpx;
	border-radius: 30rpx;
}

.supplement-box {
	margin-top: 20rpx;
	@include background_color("bg-tips");
	@include border_color("border_color");
	border: 1rpx solid;
	border-radius: 12rpx;
	line-height: 1.5;
}

.table-item {
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #ffffff;
	border-radius: 8rpx;
	padding: 26rpx;
	box-sizing: border-box;
}

.selectpicker {
	width: 400rpx;
	height: 65rpx;
	line-height: 65rpx;
	padding: 0 23rpx;
	box-sizing: border-box;
	border: 2rpx solid #bfbfbf;
	border-radius: 5rpx;
	font-size: 26rpx;
	font-weight: 500;
	color: #575757;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.selectpicker .jiantou {
	color: #575757;
	font-size: 22rpx;
}

.wrapper {
	background-color: #fff;
	margin: 0 20rpx;
	margin-top: 20rpx;
	padding: 30rpx;
}

.wrapper .acea-row {
	display: flex;
	flex-wrap: nowrap;
}

.wrapper .item {
	font-size: 28rpx;
	color: #282828;
}

.wrapper .item~.item {
	margin-top: 20rpx;
	white-space: normal;
	word-break: break-all;
	word-wrap: break-word;
}

.wrapper .item .conter {
	color: #868686;
	width: 480srpx;
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-end;
}

.wrapper .item .conter .copy {
	font-size: 20rpx;
	color: #333;
	border-radius: 3rpx;
	border: 1rpx solid #666;
	padding: 3rpx 15rpx;
	margin-left: 24rpx;
	white-space: nowrap;
}

.wrapper .actualPay {
	border-top: 1rpx solid #eee;
	margin-top: 30rpx;
	padding-top: 30rpx;
	display: flex;
	align-items: center;

	.pay-people {
		display: flex;
		align-items: center;

		image {
			width: 40rpx;
			height: 40rpx;
			border-radius: 50%;
		}

		.pay-nickname {
			margin-right: 20rpx;
			padding: 0 10rpx;
		}
	}
}

.wrapper .actualPay .money {
	font-weight: bold;
	font-size: 30rpx;
}

.acea-row.row-between {
	-webkit-box-pack: justify;
	-moz-box-pack: justify;
	-o-box-pack: justify;
	-ms-flex-pack: justify;
	-webkit-justify-content: space-between;
	justify-content: space-between;
}

.upload .pictrue {
	display: inline-block;
	margin: 22rpx 17rpx 20rpx 0;
	width: 156rpx;
	height: 156rpx;
	color: #bbb;
}

.upload .pictrue image {
	width: 100%;
	height: 100%;
}

.copy-text {
	width: max-content;
	font-size: 10px;
	border-radius: 1px;
	border: 0.5px solid #666;
	padding: 1px 7px;
	margin-left: auto;
}

.copys {
	word-break: break-all;
	word-wrap: break-word;
}
</style>